package com.five.controller;

import com.five.pojo.Result;
import com.five.pojo.review;
import com.five.service.reviewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "评论接口")
@RestController
@RequestMapping("/review")
@CrossOrigin
public class reviewController {
    @Autowired
    reviewService reviewService;
    @Operation(summary = "根据社团活动查询评论")
    @GetMapping("/getById")
    public Result getById(Integer actId){
        List<review> reviewList = reviewService.getById(actId);
        return Result.success(reviewList);
    }

    @Operation(summary = "添加评论")
    @PostMapping("/addReview")
    public Result addReview(@RequestBody review review){
        reviewService.addReview(review);
        return Result.success();
    }
}
